package LCR;

import  java.util.*;

public class Main2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            String trups = in.nextLine();
            List<String> ps = new ArrayList<>();
            for(int  i = 0;i< n;i++) {
                ps.add(in.nextLine());
            }

            int[] truetb = new int[27];
            //int[] check = new int[27];
            for(int i = 0; i < trups.length();i++) {
                truetb[trups.charAt(i)-'a']++;
            }

            int min = 0;
            int max = 0;
            for(int i = 0; i < n;i++) {
                int[] check = new int[27];
                String s = ps.get(i).toString();
                for(int j = 0;j < s.length();j++) {
                    check[s.charAt(j)-'a']++;
                }
                if(check.equals(truetb)) {
                    min = 1;
                }
                max ++ ;
            }


        }
    }
}
